import { getUserInfoAPI } from '@/api/layout.js'
export default {
  namespaced: true,
  state() {
    return {
      token: '',
      userInfo: {}
    }
  },
  mutations: {
    setToken(state, tokenStr) {
      state.token = tokenStr
    },
    setUserInfo(state, userInfoObj) {
      state.userInfo = userInfoObj
    }
  },
  actions: {
    async getUserInfoAction(ctx) {
      const { data: { data } } = await getUserInfoAPI()
      ctx.commit('setUserInfo', data)
    }
  }
}
